﻿namespace HRM.CORE
{

    using APP.HELPER.Data.Helper;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data.SqlClient;

    public class HRM_GROUP_RATE
    {
        private string m_GroupCode;
        private string m_GroupRateCode;
        private bool m_IsRate;

        public HRM_GROUP_RATE()
        {
            this.m_GroupCode = "";
            this.m_GroupRateCode = "";
            this.m_IsRate = true;
        }

        public HRM_GROUP_RATE(string GroupCode, string GroupRateCode, bool IsRate)
        {
            this.m_GroupCode = GroupCode;
            this.m_GroupRateCode = GroupRateCode;
            this.m_IsRate = IsRate;
        }

        public string Get(string GroupCode, string GroupRateCode)
        {
            string str = "";
            string[] myParams = new string[] { "@GroupCode", "@GroupRateCode" };
            object[] myValues = new object[] { GroupCode, GroupRateCode };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_GROUP_RATE_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_GroupCode = Convert.ToString(reader["GroupCode"]);
                    this.m_GroupRateCode = Convert.ToString(reader["GroupRateCode"]);
                    this.m_IsRate = Convert.ToBoolean(reader["IsRate"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public void SetData(string GroupCode, string GroupRateCode, bool IsRate)
        {
            this.m_GroupCode = GroupCode;
            this.m_GroupRateCode = GroupRateCode;
            this.m_IsRate = IsRate;
        }

        public string Update(string GroupCode, string GroupRateCode, bool IsRate)
        {
            string[] myParams = new string[] { "@GroupCode", "@GroupRateCode", "@IsRate" };
            object[] myValues = new object[] { GroupCode, GroupRateCode, IsRate };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_GROUP_RATE_Update", myParams, myValues);
        }

        public string AssemblyVersion
        {
            get
            {
                return "2.5.0.0";
            }
        }

        public string Copyright
        {
            get
            {
                return "C\x00f4ng Ty Phần Mềm Ho\x00e0n Hảo";
            }
        }

        [DisplayName("GroupCode"), Category("Primary Key")]
        public string GroupCode
        {
            get
            {
                return this.m_GroupCode;
            }
            set
            {
                this.m_GroupCode = value;
            }
        }

        [Category("Primary Key"), DisplayName("GroupRateCode")]
        public string GroupRateCode
        {
            get
            {
                return this.m_GroupRateCode;
            }
            set
            {
                this.m_GroupRateCode = value;
            }
        }

        [Category("Column"), DisplayName("IsRate")]
        public bool IsRate
        {
            get
            {
                return this.m_IsRate;
            }
            set
            {
                this.m_IsRate = value;
            }
        }

        public string Product
        {
            get
            {
                return "Class HRM_GROUP_RATE";
            }
        }
    }
}

